Form_MessageSending = function(){
	var obj = this;
	var storeType = new Ext.data.Store({
		proxy : new Ext.data.HttpProxy({url : "/media/getMedia139MailTypes"}),
		reader : new Ext.data.ArrayReader({
			fields : ["id", "name"]
		})
	});
	var comboType = new Ext.form.ComboBox({
		fieldLabel : "邮件类型",
		name : "type",
		emptyText : "请选择邮件类型...",
		valueField : "id",
		hiddenName : "id",
		displayField : "name",
		editable : false,
		triggerAction : "all",
		store : storeType
	});
	var content = new Ext.form.TextArea({
		fieldLabel: "内容",
		xtype : "textarea",
		name : "content",
		style: "width:90%",
		allowBlank : false
	});
	var fieldSet = new Ext.form.FieldSet({
        border: false,
		autoHeight: true,
		items : [comboType, content]
	});
	Form_MessageSending.superclass.constructor.call(this, {
		autoHeight: true,
		bodyStyle: "padding: 5px",
		items : [fieldSet],
		buttons : [{
			text : "发送",
			handler : function(){
				if (obj.getForm().isValid()){
					var progress = Ext.Msg.progress("发送中...", "请等待");
					Ext.Ajax.request({
						url: "/manage/send139Mail",
						params : {type : comboType.getValue(), content : obj.getForm().getFieldValues().content},
						method : "POST",
						success : function(response, options){
							progress.hide();
							var data = Ext.util.JSON.decode(response.responseText);
							if (data == "success"){
								Ext.Msg.alert("错误", "发送成功！");
							}  else {
								Ext.Msg.alert("错误", "发送失败。");
							}
						},
						failure : function(){
							progress.hide();
							Ext.Msg.alert("错误", "获取信息错误...");
						}
					});
				}
			}
		}]
    });
}

Ext.extend(Form_MessageSending, Ext.form.FormPanel, {
});

Ext.reg("App.139Mail.MessageSending", Form_MessageSending);